package com.stu.interceptor.mvc;

import com.stu.interceptor.LoginInterceptor;
import com.stu.interceptor.OpenFlagHandlerInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
@ComponentScan("com.stu.interceptor")
public class WebMvcConfiguration implements WebMvcConfigurer {

    @Autowired
    LoginInterceptor loginInterceptor;
    @Autowired
    OpenFlagHandlerInterceptor openFlagHandlerInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        System.out.println("注册");
        registry.addInterceptor(loginInterceptor).addPathPatterns("/**");

    }

  /*  public void addInterceptors(InterceptorRegistry registry) {
        //registry.addInterceptor(openFlagHandlerInterceptor).addPathPatterns("/admin/**");
        // registry.addInterceptor(loginInterceptor).addPathPatterns("/admin/**");
        *//*registry.addInterceptor(passportLogoutInterceptor).addPathPatterns("/admin/**")
        .excludePathPatterns("/admin/logined/**");*//*
        registry.addInterceptor(openFlagHandlerInterceptor).addPathPatterns("/sysUser/**")
                .excludePathPatterns("/student/**");
    }*/
}
